#include <gtest/gtest.h>
#include "src/symbols/wubi/wubi_symbol.h"

class WuBiSymbolTest : public ::testing::Test {
protected:
    void SetUp() override {
        // 设置测试环境
    }

    void TearDown() override {
        // 清理测试环境
    }
};

TEST_F(WuBiSymbolTest, Constructor) {
    // 测试构造函数
    WuBiSymbol symbol("W", "人");
    
    EXPECT_EQ(symbol.getCode(), "W");
    EXPECT_EQ(symbol.getCharacter(), "人");
}

TEST_F(WuBiSymbolTest, GetRadicals) {
    // 测试获取字根
    WuBiSymbol symbol("W", "人");
    auto radicals = symbol.getRadicals();
    
    // 由于字根分析器是简化的，这里只做基本检查
    EXPECT_FALSE(radicals.empty());
}

TEST_F(WuBiSymbolTest, ToString) {
    // 测试字符串表示
    WuBiSymbol symbol("W", "人");
    std::string str = symbol.toString();
    
    EXPECT_EQ(str, "人(W)");
}

TEST_F(WuBiSymbolTest, Similarity) {
    // 测试相似度计算
    WuBiSymbol ren("W", "人");
    WuBiSymbol gong("A", "工");
    
    double similarity = ren.similarity(gong);
    
    // 相似度应该在0到1之间
    EXPECT_GE(similarity, 0.0);
    EXPECT_LE(similarity, 1.0);
}